package com.spring.application;

import com.mchange.v2.c3p0.ComboPooledDataSource;
import com.spring.entity.Book;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.sql.DataSource;
import java.sql.SQLException;

public class SpringApplication_6 {

    //spring管理连接池
    @Test
    public void getSpringUrlPool() throws SQLException {
        ApplicationContext context = new ClassPathXmlApplicationContext("springIOC-conf-6.xml");
        DataSource dataSource = context.getBean("dataSource", DataSource.class);
        System.out.println(dataSource.getConnection());
    }
}
